//
//  NetworkAction.h
//  XMGAJ
//
//  Created by Mr.He on 5/27/16.
//  Copyright © 2016 Mr.He. All rights reserved.
//

#import <Foundation/Foundation.h>  

typedef void (^NetworkActionSuccessArrayBlock)(NSArray *modelList, NSString *message);
typedef void (^NetworkActionSuccessModelBlock)(id model, NSString *message);
typedef void (^NetworkActionSuccessVoidBlock)(NSString *message);
typedef void (^NetworkActionFailureBlock)(NSError *error); 
@interface NetworkAction : NSObject

/**
 *  获取默认单例
 */
+ (instancetype)sharedAction;

- (void)registerUserWithAccount:(NSString *)account
                       password:(NSString *)password
                          email:(NSString *)email
                        success:(NetworkActionSuccessModelBlock)success
                        failuer:(NetworkActionFailureBlock)failuer;

- (void)LoginUserWithAccount:(NSString *)account
                    password:(NSString *)password
                     success:(NetworkActionSuccessModelBlock)success
                     failuer:(NetworkActionFailureBlock)failuer;

/**
 确认用户： 
 */
- (void)isHaveUserWithPhone:(NSString *)phone
                      email:(NSString *)email
                    success:(NetworkActionSuccessModelBlock)success
                    failuer:(NetworkActionFailureBlock)failuer;
/**
 忘记密码时修改密码： 
 */
- (void)isHaveUserWithPhone:(NSString *)phone
                   password:(NSString *)password
                     userid:(NSString *)userid
                    success:(NetworkActionSuccessModelBlock)success
                    failuer:(NetworkActionFailureBlock)failuer;


/**
 直接修改密码： 
 */
- (void)changePasswordWithPhone:(NSString *)phone
                         oldPwd:(NSString *)oldPwd
                       password:(NSString *)password
                        success:(NetworkActionSuccessModelBlock)success
                        failuer:(NetworkActionFailureBlock)failuer;


/**
 修改信息
 */
- (void)changeUserInfoWithPhone:(NSString *)phone
                       nickname:(NSString *)nickname
                         avatar:(NSString *)avatar
                        success:(NetworkActionSuccessModelBlock)success
                        failuer:(NetworkActionFailureBlock)failuer;


/**
 保存数据
 */
- (void)upLoadDataInfoWithPhone:(NSString *)phone
                       jsonData:(NSString *)jsonData
                        success:(NetworkActionSuccessModelBlock)success
                        failuer:(NetworkActionFailureBlock)failuer;


/**
 加载数据
 */
- (void)downLoadDataInfoWithPhone:(NSString *)phone
                          success:(NetworkActionSuccessModelBlock)success
                          failuer:(NetworkActionFailureBlock)failuer;

@end
